package com.zhongruan.zrccddllyhn.mapper;

import com.zhongruan.zrccddllyhn.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.PutMapping;

@Mapper
public interface UserMapper {

    @Select("select * from user where username=#{username}")
    User findByName(String username);

    @Insert("INSERT INTO user(username,password,user_id,create_time,update_time)" +
            "values(#{username},#{password},#{userId},now(),now())")
    void add(String username, String password, String userId);

    @Update("update user set password=#{newPwd},update_time=now() where id=#{id}")
    void upDatePwd(String newPwd, Integer id);

    @Update("update user set user_id=#{nowCell},update_time=now() where id=#{id}")
    void updateCell(String nowCell, Integer id);
}
